package com.thti.mecool.client.command.result.work;

import com.thti.mecool.client.base.BaseActivity;
import com.thti.mecool.client.base.Cache;
import com.thti.mecool.client.base.HandlerConstant;
import com.thti.mecool.client.command.ICommand;
import com.thti.mecool.client.model.biz.WorkmemoBizImpl;
import com.thti.mecool.client.protocol.work.WorkmemoResult;
import com.thti.mecool.client.service.Protocol;

public class UpdateWorkmemoCommand implements ICommand{

	@Override
	public void doCommand(Object o) {
		WorkmemoResult workmemoResult=(WorkmemoResult)o;
		if(workmemoResult!=null){
			BaseActivity.setCurrentMesg(workmemoResult.getMsg());
			if(workmemoResult.getStatus()==1){
				WorkmemoBizImpl workmemoBizImpl=new WorkmemoBizImpl(Cache.getmContext());
				workmemoBizImpl.updateMemoDto(workmemoResult.getAttachment().getMemo());
			BaseActivity.setDataFlag(HandlerConstant.MemoEditCommand);}
		}else{
			BaseActivity.setFailName("更新备忘");
			BaseActivity.setDataFlag(HandlerConstant.CommandFail);
		}
		
	}

	@Override
	public String getCommandID() {
		
		return Protocol.getUpdateWorkmemo;
	}

	@Override
	public Class<?> getCommandClass() {
		// TODO Auto-generated method stub
		return WorkmemoResult.class;
	}

}
